package pe.gob.mtpe.renoccsys.mybatis.implementacion;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import pe.gob.mtpe.renoccsys.bean.Cantra;
import pe.gob.mtpe.renoccsys.mybatis.comun.MyBatisConnectionFactory;
import pe.gob.mtpe.renoccsys.mybatis.interfase.INTCantra;

public class IMPCantra implements INTCantra {
	
	
	private SqlSessionFactory sqlSessionFactory;
	
	public IMPCantra(){
		sqlSessionFactory=MyBatisConnectionFactory.getSqlSessionFactory();
	}

	@Override
	public void insertar(Cantra objCantidadTrabajadores) throws Exception {
		
		SqlSession session = sqlSessionFactory.openSession();

		try {
			
		
		    session.insert("Cantra.insertar",objCantidadTrabajadores);
						
			session.commit();
			
		} 
		catch(Exception ex){
			session.rollback();
			
		}
		finally {
			session.close();
		}

	}

}
